<?php 
include_once('connection/connection.php');
include('header.php');
include('menu.php');
include('config.php');

function blanck($var)
{
if($var!="")
{
    return $var;
}
}

function getName($colName,$id)
{
	$sqlgetName="select distinct ".$colName."_name from tbl_lookup_location where ".$colName."_id in(".$id.")";
	$querygetName=mysql_query($sqlgetName);
	while($rowgetName=mysql_fetch_row($querygetName))
	{
	$name=$name."-".$rowgetName[0];
	}

	$name=explode("-",$name);
	$name=array_filter($name, "blanck");
	return $name=implode($name,",");
}
$frm=$_SESSION['form_id'];
$qr="select * from tbl_dtls_ufw_main where form_id='$frm'";
$res=mysql_query($qr);
$row=mysql_fetch_array($res);
$dis=$row['multi_dist_id'];
$dis_name=getName('district',$dis);
$_SESSION['dis_name']=$dis_name;
$tehsil=$row['tehsil_id'];
$id1=$row['id'];
$_SESSION['id1']=$id1;
$qr1="select census_subdistrict_name from tbl_lookup_location where district_id='$dis' and census_subdistrict_code='$tehsil'";
$res1=mysql_query($qr1);
$row1=mysql_fetch_array($res1);
if(isset($_POST['back']))
{ 
	header('Location: view_ufw.php');
}	
if(isset($_POST['submit']))
{ 
	//echo $form_id=$_POST['form_id'];
	//echo $_SESSION['form_id']=$form_id;
	header('Location: view_ufw_2.php');
}	
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="css/style_question.css" type="text/css" rel="stylesheet" />
<title>View Q1</title>
</head>
<body>
<div align="center">
<form action="" method="post" enctype="multipart/form-data">
	<table border="0" width="802" id="table1" cellspacing="0" cellpadding="0">
		<tr>
			<td width="802" height="30">
			<p align="center">
			<font face="Verdana" style="font-size: 10pt; font-weight: 700" color="#000000">
			UFW Form</font></td>
		</tr>
	
		<tr>
			<td align="center"><font face="Arial" style="font-size: 8.5pt" color="#000000">page 1</font></td>
		</tr>
		<tr>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td bgcolor="#EEEEEE" height="22"><font color="#000000">&nbsp;
			<font style="font-size: 8.5pt; font-weight: 700" face="Arial">
			RWSS Details </font></font>			</td>
		</tr>
		<tr>
			<td height="66">
				<table border="1" width="800" id="table2" bgcolor="#FDF9EE" cellspacing="1" cellpadding="0" style="border-collapse:collapse; border-color:#99CCCC;">
					<tr>
						<td colspan="4">
							<span style="font-size: 4pt">&nbsp;</span>						</td>
					</tr>
					<tr>
						<td width="192" height="25">
							<font face="Verdana" style="font-size: 8.5pt" color="#000000"><font color=                            "#FF0000">&nbsp;&nbsp;*</font>Name of RWSS</font></td>
						<td width="257"><label id="district"><font face="Verdana" style="font-size: 8.5pt">&nbsp;<?php echo $id="$row[name_rwss]"; ?></font></label></td>
						<td width="117">
							<font face="Verdana" style="font-size: 8.5pt" color="#000000"><font color=                            "#FF0000">*</font>Date&nbsp;&nbsp;</font>						</td>
            			<td width="219"><label id="date"><font face="Verdana" style="font-size: 8.5pt">&nbsp;<?php echo "$row[date]";?></font></label></td>
					</tr>
					<tr>
						<td width="192" height="28">
							<font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;
							<font color="#FF0000">*</font>Name of Survey Team Leader </font>						</td>
						<td colspan="3"><label id="block"><font face="Verdana" style="font-size: 8.5pt">&nbsp;<?php echo $id="$row[team_leader]";?></font></label>
					    <label id="tehsil"></label></td>
					</tr>
				</table>		  </td>
		</tr>
		<tr>
			<td><span style="font-size: 4pt">&nbsp;</span></td>
		</tr>
		<tr>
			<td bgcolor="#EEEEEE" height="22"><font color="#000000">&nbsp;
				</font><span style="font-weight: 700">
				<font face="Arial" style="font-size: 8.5pt" color="#000000">RWSS Source Village</font></span>			</td>
		</tr>
		<tr>
			<td><span style="font-size: 3pt">&nbsp;</span></td>
		</tr>
		<tr>
			<td>
			<table width="800" height="180" border="1" cellpadding="0" cellspacing="1" bgcolor="#FDF9EE" id="table6" style="border-collapse:collapse; border-color:#99CCCC;">
				<tr>
					<td height="7" colspan="2"><span style="font-size: 4pt">&nbsp;</span></td>
				</tr>
				<tr>
					<td height="28" colspan="2">&nbsp;
						<font style="font-size: 8.5pt" face="Verdana" color="#000000">
						No. of Source Villages&nbsp;&nbsp;(<?php echo "$row[num_source]"; ?>)</font>					<label id="type_scheme">
				      <table width="100%" border="1" cellpadding="0" cellspacing="1" bgcolor="#FDF9EE" id="table6" style="border-collapse:collapse; border-color:#99CCCC;">
					<tr><td align="center" width="23%" bgcolor="#F7E6B7" height="23"><font face="Verdana" style="font-size: 8.5pt" color="#990000">District Name</font></td>
					<td align="center" width="25%" bgcolor="#F7E6B7" height="23"><font face="Verdana" style="font-size: 8.5pt" color="#990000">Block Name</font></td>
					<td align="center" width="28%" bgcolor="#F7E6B7" height="23"><font face="Verdana" style="font-size: 8.5pt" color="#990000">Grampanchayat Nmae</font></td>
					<td align="center" width="24%" bgcolor="#F7E6B7" height="23"><font face="Verdana" style="font-size: 8.5pt" color="#990000">Village Name</font></td>
					</tr>
					
					<font style="font-size: 8.5pt" face="Verdana">&nbsp;
					<?php 
					$qrVillage="select * from tbl_dtls_ufw_src_village where loc_id='$id1'";
                    $resVillage=mysql_query($qrVillage);
                    while($rowVillage=mysql_fetch_array($resVillage))
					{
					?>
					<tr>
					<td height="25"><div align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo $rowVillage['district'] ; ?></font></div></td>
					<td><div align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo $rowVillage['block'] ; ?></font></div></td><td><div align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo $rowVillage['panchayat'] ; ?></font></div></td><td><div align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo $rowVillage['village'] ; ?></font></div></td>
					
					<?php
					}
					?>
					</tr>
					    </table></td>
				</tr>
				
				<tr>
					<td width="297" height="26">
						<font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp; 
						Total quantity of water produced at &nbsp;source (KLD) </font></td>
					<td width="494"><label id="name_scheme"><font style="font-size: 8.5pt" face="Verdana">&nbsp;<?php echo "$row[water_source]";?></font></label></td>
				</tr>
				<tr>
					<td width="297" height="28">
						<font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp; 
						Year of Commissioning</font></td>
					<td width="494"><label id="year_comm"><font style="font-size: 8.5pt" face="Verdana">&nbsp;<?php echo "$row[year_com]";?></font></label></td>
				</tr>
				<tr>
					<td width="297" height="28">
						<font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp; 
						Initial Investment (in <img src="images/26rup1.jpg" width="10"> Lakh)</font></td>
						<!--<font face="Rupee Foradian" size="3">`</font>-->
				  <td width="494"><label id="capital_cost"><font style="font-size: 8.5pt" face="Verdana">&nbsp;<?php echo "$row[capital]";?></font></label></td>
				</tr>
			</table>		</td>
	</tr>
	<tr>
		<td>
			<span style="font-size: 5pt">&nbsp;</span>		</td>
	</tr>
	<tr>
		<td bgcolor="#EEEEEE" height="22"><font color="#000000">&nbsp;
			<font style="font-size: 8.5pt; font-weight: 700" face="Arial">
			RWSS Location </font></font>		</td>
	</tr>
	<tr>
		<td>
			<table border="1" width="800" id="table7" bgcolor="#FDF9EE" cellspacing="1" cellpadding="0" style="border-collapse:collapse; border-color:#99CCCC;">
				<tr>
					<td height="11" colspan="4">
						<span style="font-size: 4pt">&nbsp;</span></td>
				</tr>
				<tr>
				  <td height="29"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;&nbsp;<font color="#FF0000">*</font>Districts</font></td>
				  <td><label id="gp"><font face="Verdana" style="font-size: 8.5pt">&nbsp;<?php  $id="$row[multi_dist_id]"; echo getName('district',$id);?></label></td>
			  </tr>
				<tr>
				  <td height="29"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;&nbsp;<font color="#FF0000">*</font>Blocks</font></td>
				  <td><label id="gp"><font face="Verdana" style="font-size: 8.5pt">&nbsp;<?php  $id="$row[multi_block_id]"; echo getName('block',$id);?></label></td>
			  </tr>
				<tr>
					<td width="287" height="29">
						<font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;&nbsp;<font color="#FF0000">*</font>Grampanchayat</font>					</td>
					<td width="504"><label id="gp"><font face="Verdana" style="font-size: 8.5pt">&nbsp;<?php  $id="$row[multi_panchayat_id]"; echo getName('panchayat',$id);?></label></td>
				</tr>
				<tr>
					<td width="287">&nbsp;
						<font style="font-size: 8.5pt" face="Verdana" color="#000000"><font color="#FF0000">*</font>Village (s) Covered Names &nbsp;&nbsp;&nbsp;(MH)</font></td>
					<td width="504"><label id="village"><font face="Verdana" style="font-size: 8.5pt">&nbsp;<?php $id="$row[multi_village_id]"; echo getName('village',$id);?></label></td>
				</tr>
				<tr>
					<td width="287" height="24">&nbsp;
						<font style="font-size: 8.5pt" face="Verdana" color="#000000"><font color="#FF0000">*</font>Form Id</font></td>
					<td width="504"><label id="formid"><font face="Verdana" style="font-size: 8.5pt">&nbsp;<?php echo "$row[form_id]";?></font></label></td>
				</tr>
				<tr>
					<td width="287" height="28">&nbsp;
						<font style="font-size: 8.5pt" face="Verdana" color="#000000"><font color="#FF0000">*</font>Census Village Code</font></td>
					<td width="504"><label id="census"><font face="Verdana" style="font-size: 8.5pt">&nbsp;<?php echo "$row[cvc]";?></font></label></td>
				</tr>
				<tr>
					<td colspan="4" bgcolor="#EEEEEE">&nbsp;
					<font style="font-size: 8.5pt; font-weight: 700" face="Arial" color="#000000">
					3.Other Habitations (OH) covered</font></td>
				</tr>
			</table>		</td>
	</tr>
	<tr>
		<td><table border="1" width="800" id="table4" cellspacing="1" cellpadding="0" bgcolor="#FDF9EE" style="border-collapse:collapse; border-color:#99CCCC;">
          <tr>
            <td colspan="8"><span style="font-size: 4pt">&nbsp;</span></td>
          </tr>
          <tr>
            <td align="center" width="14%" bgcolor="#F7E6B7" height="36"><font face="Verdana" style="font-size: 8.5pt" color="#990000"> Name of OH</font></td>
            <td align="center" width="14%" bgcolor="#F7E6B7" height="36"><font style="font-size: 8.5pt" face="Verdana" color="#990000"> Code No. (As per IMIS)</font></td>
            <td align="center" width="10%" rowspan="" bgcolor="#F7E6B7"><font style="font-size: 8.5pt; font-style: normal" face="Verdana" color="#990000">Type MH/ OH</font></td>
            <td align="center" width="12%" bgcolor="#F7E6B7" height="36"><font face="Verdana" style="font-size: 8.5pt" color="#990000">Actual Status at Site (A/NA)</font></td>
            <td align="center" width="12%" bgcolor="#F7E6B7" height="36"><font face="Verdana" style="font-size: 8.5pt" color="#990000">Population as per 2001</font></td>
            <td align="center" width="13%" bgcolor="#F7E6B7" height="36"><font face="Verdana" style="font-size: 8.5pt" color="#990000">Current population 2010</font></td>
            <td align="center" width="10%" bgcolor="#F7E6B7" height="36"><font face="Verdana" style="font-size: 8.5pt" color="#990000">Projected population 2025</font></td>
            <td align="center" width="15%" bgcolor="#F7E6B7" height="36"><font face="Verdana" style="font-size: 8.5pt" color="#990000">Quantity of water received at village boundary (KLD)</font></td>
          </tr>
          <?php
				$qr2="select * from tbl_dtls_ufw_habit where loc_id='$id1'";
				$res2=mysql_query($qr2);
				while($row2=mysql_fetch_array($res2))
				{
				?>
          <tr>
            <td width="14%" height="23" align="center"><label id="habit_name"><font face="Verdana" style="font-size: 8.5pt"><?php echo "$row2[habit_name]";?></font></label></td>
            <td width="14%" align="center"><label id="habit_code"><font face="Verdana" style="font-size: 8.5pt"><?php echo "$row2[habit_code]";?></font></label></td>
            <td align="center" width="10%"><label id="type_habit"><font face="Verdana" style="font-size: 8.5pt"><?php echo "$row2[type_habit]";?></font></label></td>
            <td width="12%" align="center"><label id="status_e_nt"><font face="Verdana" style="font-size: 8.5pt"><?php echo "$row2[status_a_na]";?></font></label></td>
            <td width="12%" align="center"><label id="status_e_nt"><font face="Verdana" style="font-size: 8.5pt"><?php echo "$row2[pop_2001]";?></font></label></td>
            <td width="13%" align="center"><label id="status_e_nt"><font face="Verdana" style="font-size: 8.5pt"><?php echo "$row2[pop_2010]";?></font></label></td>
			<td width="12%" align="center"><label id="status_e_nt"><font face="Verdana" style="font-size: 8.5pt"><?php echo "$row2[pop_2025]";?></font></label></td>
            <td width="13%" align="center"><label id="status_e_nt"><font face="Verdana" style="font-size: 8.5pt"><?php echo "$row2[water_boundary]";?></font></label></td>
          </tr>
          <?php } ?>
        </table></td>
	</tr>
	<tr>
		<td><div id="habit"></div></td>
	</tr>
	
	<tr>
		  <td bgcolor="#EEEEEE" height="22"><font color="#000000">&nbsp; <font style="font-size: 8.5pt; font-weight: 700" face="Arial">No. of Unlisted Habitation</font></font></td>
		</tr>
		<tr><td>
		<table border="1" cellspacing="0" cellpadding="0" bgcolor="#FDF9EE" style="border-collapse:collapse; border-color:#99CCCC;">
		<tr><td width="230px" align="center" bgcolor="#F7E6B7"><font style="font-size: 8.5pt" face="Verdana" color="#990000">Unlisted Habitation Name</font></td></tr>
		<?php
				$qrUnhabit="select * from tbl_dtls_ufw_unhabit where loc_id='$id1'";
				$resUnhabit=mysql_query($qrUnhabit);
				while($rowUnhabit=mysql_fetch_array($resUnhabit))
				{
				?>
		<tr><td height="24"><label id="unhabit1"><font style="font-size: 8.5pt" face="Verdana">&nbsp;&nbsp;&nbsp;<?php echo "$rowUnhabit[unhabit_name]";?></font></label></td></tr>
		<?php
		}
		?>
		</table>
		</td></tr>
	<tr>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td>
			<p align="center">
			<input type="submit" value="Back" name="back" style="font-size: 8pt;font-family:Verdana; border-style: solid; border-width: 1px">&nbsp;&nbsp;
			<input type="submit" value="Next" name="submit" style="font-size: 8pt; font-family: Verdana; border-style: solid; border-width: 1px" onClick="return validate1()">&nbsp;</p>		</td>
	</tr>
	<tr>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td>&nbsp;</td>
	</tr>
</table>
</form>		
</div>
</body>
</html>
